qui(
    function (require, exports, module) {
        VOD.Edit = function (options) {
            this.dao = VOD.Dao;
            this.task = VOD.Task;
            this.config = VOD.Config;
            this.options = options || {};
        };
        Com.inherits(VOD.Edit,     Ancestor.Grid, function (options) {
        }).extend({
            init: function () {
                VOD.Player.initPlayer();
                var self = this;
                self.initPointTime();
                self.initDlg();
                self.bindEvent();
                self.initBodyEvent();
                self.initSuggest();
                self.initInterValTask();
                self.initGrid();
                VOD.Util.limitWordCount($("input[name=videoName]"), 43,null,null,function(length){
                    $("span.leftWordsCount").text(length);
                });
                VOD.Util.limitWordCount($("textarea[name=fantasyTitle]"), 80,true,['\r','\n'],function(length){
                    $("span.leftWordsCount1").text(length);
                });
            },

            initBodyEvent: function () {
                var self = this;
                var browser = VOD.Util.getUserAgent();
                VOD.Util.detectBrowserSupport(browser);
                VOD.Util.LayoutInit();


                VOD.Util.autoSegmentationTabOptions({});

                self.dao.storageData('ASS', 'off'); // 自动拆条开关
                self.dao.storageData('BCS', 'off'); // 背景颜色开关

                //  self.dao.getAlbum();
//                $('body [href^=#]').click(function (e) {
//                    e.preventDefault();
//                });

//                VOD.Evt.segInputAddBackgroundColor();
//                VOD.Evt.segInputScroll();
//                VOD.Evt.segInputBlur();
                VOD.Evt.InitBindEvt();

                VOD.Util.browserZoomTips();
                $("body").show();
                $("body").on('click', '[action-name]', function () {
                    var self = $(this),
                        name = self.attr('action-name');
                    switch (name) {
                        case 'segmentation':
                            VOD.Evt.ShowAndHideSegmentationList();
                            break;
                        case 'switch': // 拆条背景颜色打开与关闭
                            VOD.Evt.OpenOrCloseBk(self);
                            break;
//                        case 'auto-segmentation': // 自动拆条
//                            VOD.Evt.AutoSegmentate(self);
//                            break;
//                        case 'auto-segmentation-tab': // 自动拆条tab标签上的参数选项禁用与否
//                            VOD.Evt.OpenSegmentationTabOptions({
//                                name: 'auto-segmentation-tab'
//                            });
//                            break;
//                        case 'merge-segmentation-tab':
//                        case 'segmentation-params-tab':
//                            VOD.Evt.OpenSegmentationTabOptions({
//                                name: ''
//                            });
//                            break;
                        case 'select-all':
                            VOD.Evt.SelectAll(self);
                            break;
//                        case 'sub-seg':
//                            VOD.Evt.SubAutoSeg(self);
//                            break;
//                        case 'sub-ad':
//                            VOD.Evt.SubAutoAd(self);
//                            break;
                        case 'checked-seg-id':
                            VOD.Evt.CheckedSegId(self);
                            break;
                        case 'sub-all-seg':
                            VOD.Evt.SubAllSeg(self);
                            break;
                        case 'sub-all-ad':
                            VOD.Evt.SubAllAd(self);
                            break;
                        case 'sub-all-merge':
                            VOD.Evt.SubAllMerge(self);
                            break;
//                        case 'sub-all-del':
//                            VOD.Evt.SubAllDel(self);
//                            break;
                        case 'save-ad-smart-library':
                            VOD.Evt.saveAdLibrary(self);
                            break;
                        case 'save-album-smart-library':
                            VOD.Evt.saveAlbumLibrary(self);
                            break;

                        default:
                            break;
                    }

                });
            },

            initInterValTask: function () {
                var self = this;
                setInterval(self.task.getData, 5000);   // 获取图片数据
                //setInterval(getCate,20000);
                setInterval(self.task.getSty2, 19000);   // 智能识别数据
                setInterval(self.task.getOcr, 23000);
                setInterval(self.task.getAcr, 11000);
            },
            initPointTime: function () {
                //默认时间
                var today_d = new Date();

                if(today_d.getMinutes() > 2  ){
                    today_d.setTime(today_d.getTime()- 120000 );
                }
                var s_d = VOD.Util.formatDateTimeFormat(today_d );
                today_d.setTime(today_d.getTime() +  4*3600*1000 );
                var e_d = VOD.Util.formatDateTimeFormat(today_d );
                $('#inputStartTime').val(s_d);
                $('#inputEndTime').val(e_d);
                if( s_d >= e_d){
                    return
                }
                VOD.Util.bindDate("inputStartTime", "inputEndTime", { maxDate: e_d, maxDateTime: new Date(e_d.replace(/-/g, "/")), minDate: s_d, minDateTime: new Date(s_d.replace(/-/g, "/"))});
                $("input[name=inputStartTime]").datetimepicker("setDate", new Date(s_d.replace(/-/g, "/")));
                $("input[name=inputEndTime]").datetimepicker("setDate", new Date(e_d.replace(/-/g, "/")));
            },
            initDlg: function () {
                var self = this;

                $("#ocr-dlg").dialog({
                    title: "修改标题",
                    resizable: false,
                    dialogClass: 'alert',
                    autoOpen: false,
                    width: 600,
                    modal: true})
                $("#acr-dlg").dialog({
                    title: "修改描述",
                    resizable: false,
                    dialogClass: 'alert',
                    autoOpen: false,
                    width: 600,
                    modal: true
                })


                $("#alert-dlg").dialog({
                    title: "定时提醒",
                    resizable: false,
                    dialogClass: 'alert',
                    autoOpen: false,
                    width: 600,
                    modal: true
                })
                self.initAlterTitleDlg();
                self.initHelp();
                self.initHelp2();
                $(".ui-dialog-titlebar-close").html('<span class="ui-button-icon-primary ui-icon ui-icon-closethick"></span><span class="ui-button-text">close</span>');
                $('#alert-time').datetimepicker();
                $("#help-pop").bind("click", function () {
                    var helpDlg = null;
                    if(VOD.Util.isTab2Show() || VOD.Util.isTab3Show()){
                        helpDlg = $("#help2-dlg")
                    }else{
                        helpDlg =  $("#help-dlg")
                    }

                    if (self.dao.storageData('coderVersion') == undefined) {
                        self.dao.getCodeVersion({});
                        if (self.dao.storageData('coderVersion') == undefined) {
                            self.dao.storageData('coderVersion', '0 | 0 | 0');
                        }
                        helpDlg.dialog("open");
                        helpDlg.find("label[name=coderVersion]").html("版本 V3.2.2 | " + self.dao.storageData('coderVersion'));
                    } else {
                        helpDlg.dialog("open");
                    }
                })
                $("#ocr").bind("click",function(e){
                    if ($("#ocr").hasClass("disabled")) {
                      return ;
                    }
                    $("#ocr-dlg").dialog("open");
                    VOD.Evt.setOcrTitleList();
                })
                $("#acr").bind("click",function(e){
                    if ($("#acr").hasClass("disabled")) {
                        return ;
                    }
                    $("#acr-dlg").dialog("open");
                    VOD.Evt.setAcrTitleList();
                })
                $("#alert-pop").bind("click", function () {
                    $("#alert-dlg").dialog("open");
                })
                $("button[name=alert-dlg-cancel]").bind("click", function (e) {
                    $("#alert-dlg").dialog("close");
                });
                $("button[name=alert-dlg-ok]").bind("click", function (e) {
                    VOD.Evt.RegularTimeRemind();
                    $("#alert-dlg").dialog("close");
                });
                $("button[name=ocr-dlg-cancel]").bind("click", function (e) {
                    $("#ocr-dlg").dialog("close");
                });
                $("button[name=ocr-dlg-ok]").bind("click", function (e) {
                    VOD.Evt.setVideoName();
                    $("#ocr-dlg").dialog("close");
                });
                $("button[name=acr-dlg-cancel]").bind("click", function (e) {
                    $("#acr-dlg").dialog("close");
                });
                $("button[name=acr-dlg-ok]").bind("click", function (e) {
                    VOD.Evt.setVideoDesc();
                    $("#acr-dlg").dialog("close");
                });
                $('button[data-dismiss=modal]').on('click', function () {
                    VOD.AccurateFrame. accurateStartEndRemove()
                });
            },
            initHelp:function(){
                $("#help-dlg").dialog({
                    title: "打点系统帮助",
                    resizable: false,
                    dialogClass: 'alert',
                    autoOpen: false,
                    width: 600,
                    modal: true
                })
                var innerText = "";
                $.each(VOD.Config.HELP_DATA, function (i, data) {
                    innerText += '<tr><td>' + data[0] + '</td><td>' + data[1] + '</td></tr>'
                })
                $("#help-dlg").find("tbody").html(innerText);
            },
            initHelp2:function(){

            },
            initAlterTitleDlg:function(){

            },
            bindEvent: function () {
                var self = this;
                var settings = self.dao.settings;
                var global = VOD.Config.Global;
                VOD.Evt.InitBindEvt();

                var sty = '';
                $('#submitStartTime').click(function () {
                    if (self.dao.storageData('ASS') == 'on') {
                        if (!self.dao.storageData('sty-intval')) {
                         //   sty = setInterval(self.dao.getSty, 10000);
                            self.dao.storageData('sty-intval', 1);
                        }
                    } else {
                        clearInterval(sty);
                        self.dao.storageData('sty-intval', 0);
                        self.dao.storageData('sty-index', 0);
                        VOD.g_mi = 0;
                        VOD.g_i = 0;
                    }

                    // 清除已列拆条
                    $('.inner-table').parents('tr').remove();
                    $('.merg-seg-tips,.auto-seg-tips').show();

                    self.updateDaoSetting();
//                    if (error.length) {
//                        //alert(error);
//                        VOD.Plugin.tips("error", error);
//                        return false;
//                    }
                    VOD.Config.PageBeanFrame.setNewData([]);
                    VOD.Config.PageBeanAdvert.setNewData([]);
                    VOD.Util.updateGridFrame();
                    VOD.Util.updateGridAdvert();
                    var start = VOD.Util.validStart();
                    if (!start) {
                        return false;
                    }
                    $('#makedImg').html('正在请求数据，请等待！');
                    var paramsData = self.dao.getParamsData();
                    var dotData = self.dao.getDotData();
                    $.ajax({
                        type: "get",
                        url: dotData.initUrl,
                        data: {
                            'start': start,
                            'period': settings.period,
                            'code': paramsData.channel_name,
                            'from_client': true
                        },
                        success: function (data) {
                            if (data.taskid) {
                                settings.taskid = parseInt("" + data.taskid);
                                settings.lastImg = 0;
                                //开始请求数据
                                settings.isStart = true;
                                $('#makedImg').empty();
                                self.task.getData();
                                if( $("li[aria-controls=tab3]").length > 0){
                                    self.queryNews();
                                }
                            } else {
                                //alert('系统错误:任务id为空');
                                VOD.Plugin.tips("error", '系统错误:任务id为空');
                                return false;
                            }
                        },
                        dataType: "json",
                        error: function () {
                            //alert('网络错误');
                            VOD.Plugin.tips("error", '网络错误');
                        }
                    });
                    //////////////////////////////////////////
                    VOD.Advert.clearCache();
                    //////////////////////////////////////////
                })

                $('#changeBigPic').click(function () {
                    settings.lb = 1;
                    $('.right img').css({
                        'width': '264px',
                        'height': '204px'
                    });
                    VOD.Config.Global.picWH = VOD.Config.BIG_PIC_MODE;

                    $(this).addClass('btn-primary');
                    $('#changeSmallPic').removeClass('btn-primary');
                    $('.breakWord').remove();
                    if (global.isClicked) {
                        var sTop = $('#makedImg').scrollTop() + $('.red').offset().top;
                        $('#makedImg').scrollTop(sTop);
                    }
                    global.smallPic = false;
                    $('.fp_time').removeClass('fp_time').addClass('fp_time2');
                    $('.in-out-mark-s').addClass('in-out-mark-b');
                    settings.fpTime = 'fp_time2';
                    VOD.Util.getLineWidth();
                    VOD.Util.addClearFix();
                    $("#play-one").css({
                        width: "274px",
                        height: "210px"
                    });
                })
                $('#changeSmallPic').click(function () {
                    settings.lb = 1;
                    $('.right img').css({
                        'width': '104px',
                        'height': '64px'
                    });
                    VOD.Config.Global.picWH = VOD.Config.SMALL_PIC_MODE;

                    $(this).addClass('btn-primary');
                    $('#changeBigPic').removeClass('btn-primary');
                    $('.breakWord').remove();
                    if (global.isClicked) {
                        sTop = $('#makedImg').scrollTop() + $('.red').offset().top;
                        $('#makedImg').scrollTop(sTop);
                    }
                    global.smallPic = true;
                    $('.fp_time2').removeClass('fp_time2').addClass('fp_time');
                    $('.in-out-mark-s').removeClass('in-out-mark-b');
                    settings.fpTime = 'fp_time';
                    VOD.Util.getLineWidth();
                    VOD.Util.addClearFix();
                    $("#play-one").css({
                        width: "140px",
                        height: "105px"
                    });
                })

                // 标题、专辑、合作方suggest鼠标移出隐藏
//                $('.cn_hide,.cn_hide2,.cn_hide3').hover(function () {
//                }, function () {
//                    $(this).hide();
//                })
                self.bindReviewInfo();
                self.bindAddInfo();
                self.bindJumpSubmitHandler();
                self.bindMarkImgHandler()

                $('#adv').click(function () {
                    //   20
                    $('input[name=videoName]').suggest("setValue", {id: 20, label: "广告"});
                    $('input[name=categoryName],input[name=albumName],input[name=imageId]').attr('disabled', 'disabled');
                });
                $('#mer').click(function () {
                    $('input[name=videoName]').suggest("setValue", "");
                    $('input[name=categoryName],input[name=albumName],input[name=imageId]').removeAttr('disabled');
                });
                $('.cVideo').click(function () {
                    $('input[name=albumName],input[name=imageId],input[name=categoryName]').removeAttr('disabled');
                })
                $('select[name=jumpType]').change(function () {
                    if ($(this).val() == 1) {
                        $('#jumpContent').val('00:00:00');
                    } else {
                        $('#jumpContent').val('0');
                    }
                })
                $('#autoRunPic').click(function () {
                    if ($(this).prop('checked')) {
                        sTop = $('#makedImg')[0].scrollHeight;
                        $('#makedImg').scrollTop(sTop);
                    }
                })

                $("input[name=videotype]").bind('click', function () {
                    //settings.videonameArr = [];
                    $('input[name=videoName]').suggest("setValue", "");
                    $("input[name=albumName]").suggest("setValue", "");
                    if ($(this).val() == -1) {
                        $("#ocr").show();
                        $("#acr").show();
                        $('#fantasyTitleDiv').css('display', 'block');
                        if ($("input[name=categoryName]").suggest("getValue") == 25) {
                            $("#locationDiv").show();
                        } else {
                            $("#locationDiv").hide();
                        }
                    } else {
                        $("#locationDiv").hide();
                        $('#fantasyTitleDiv').css('display', 'none');
                        $("#ocr").hide();
                        $("#acr").hide();
                    }
                    var categoryName = $("input[name=categoryName]").val();
                    VOD.Util.setCooperativePartner(categoryName);
                });

//                $("input[name=videoName]").focus(function () {
//                    $(this).addClass("videoName")
//                }).blur(function () {
//                    $(this).removeClass("videoName");
//                });
                //奇艺频道suggest标题接口
//                $("input[name=videoName]").bind('input propertychange', function () {
//
//                    var videotype = $('input[name=videotype]:checked').val();
//                    if (word && videotype != -1) {
//                        $.get('http://lego.iqiyi.com/suggest/simple-video', {
//                            'word': word,
//                            'type': 'properTitle',
//                            'isMade': videotype
//                        }, function (item) {
//                            $('.cn_hide').empty();
//                            if (item.code == 'A00000') {
//                                var messages = item.data;
//                                if (messages.length) {
//                                    settings.videonameArr = [];
//                                    $.each(messages, function (index, message) {
//                                        videonameArr.push(message.properTitle);
//                                        var rhtml = '<p class="spe" onclick="put_input(\'' + message.entityId + '\',\'' + message.properTitle + '\',\'' + message.categoryId + '\',\'' + message.categoryName + '\',\'' + message.albumId + '\',\'' + message.albumDisplayName + '\')" style="margin:0px;padding-bottom:5px;cursor:pointer">' + message.properTitle + '</p>';
//                                        $('.cn_hide').append(rhtml);
//                                    })
//                                    $('.cn_hide').show();
//                                } else {
//                                    $("input[name=videoId]").val("");
//                                    $('.cn_hide').hide();
//                                }
//                            }
//                        }, 'json')
//                    }
//
//                });

                $('input[name=eTime]').blur(function () {
                    VOD.Util.fillDefaultTitle();
                })
            },
            updateDaoSetting: function () {
                var self = this;
                var settings = {
                    index: 1,
                    stime: 0,
                    etime: 0,
                    pic: 0,
                    taskid: 0,
                    lastImg: 0,
                    delList: [],
                    subData: [],
                    needDatas: [],
                    isStart: false,
                    isSetFpTime: false,
                    lb: 1,
                    firstFpTime: 0,
                    last_i: 0,   // 上次识的库索引
                    adLibList: [],
                    isOver: 1  //防止并发
                }
                if (!$('#changeBigPic').hasClass('btn-primary')) {
                    settings.fpTime = 'fp_time';
                } else {
                    settings.fpTime = 'fp_time2';
                }
                VOD.Util.updateObjectData(settings, self.dao.settings);
            },
            bindAddInfo: function () {
                $('#d_addInfo').click(function () {
                    if (VOD.Util.del_submit()) {
                        //alert('删除成功');
                        VOD.Plugin.tips("success", '删除成功');
                    }
                    $('#d_addInfo').removeAttr('disabled').html('提交');
                })
                $('#addInfo').click(function () {
                    if (VOD.Util.dot_submit()) {
                        //alert('打点成功');
                        VOD.Plugin.tips("success", '打点成功');
                    }
                    $('#addInfo').removeAttr('disabled').html('提交');
                });
            },
            bindReviewInfo: function () {
                var self = this;
                $('#reviewInfo').bind("click", function (e) {
                    var sTime = $('input[name=sTime]').val(),
                        eTime = $('input[name=eTime]').val();
                    VOD.Util.doReview(sTime, eTime, true)
                })
                $('#d_reviewInfo').bind("click", function (e) {
                    var sTime = $('input[name=d_sTime]').val(),
                        eTime = $('input[name=d_eTime]').val();
                    VOD.Util.doReview(sTime, eTime, false)
                })

            },

            bindMarkImgHandler: function () {
                var self = this;
                var settings = self.dao.settings;
                $('#makedImg').on('click', 'img,.transparent_class', function () {
                    VOD.Config.Global.isClicked = true;  // 大小图片切换滚动到当前图片用
                    if ($(this).parent().find(".layout").hasClass("red"))
                        return;
                    $('.layout').removeClass('red');
                    if ($(this).parent().find(".layout").length !== 0)
                        $(this).parent().find(".layout").addClass("red");
                    else
                        $(this).parent().append(VOD.Config.RED_LAYOUT);
                    settings.pic = settings.etime = settings.stime = $(this).parent().find('.pid').text().replace(/\s+/g, "");
                })
            },
            bindJumpSubmitHandler: function () {
                $('#jumpSubmit').click(function () {
                    var jumpType = $('select[name=jumpType]').val();
                    if (jumpType == 1) {
                        var jc = $('#jumpContent').val();
                        if (!VOD.Util.isJumpData(jc, 1)) {
                            //alert('跳转输入格式错误');
                            VOD.Plugin.tips("error", '跳转输入格式错误');
                            return false;
                        }
                        var jumpContent = jc.replace(/:/g, "-");
                        if (!$('.relative').hasClass(jumpContent)) {
                            var temStr = jumpContent.substr(jumpContent.length - 2);
                            if (temStr.length == 2 && temStr.substr(0, 1) == '0') {
                                temStr = temStr.charAt(temStr.length - 1);
                            }
                            var lasStr = parseInt(temStr);
                            if (lasStr == 0) {
                                lasStr += 10;
                            }
                            var beforeStr = jumpContent.substr(0, jumpContent.length - 2)
                            var untilStr = lasStr - 10;
                            if (untilStr < 0)
                                untilStr = 0;
                            var us
                            for (var i = lasStr; i >= untilStr; i--) {

                                if (i < 10) {
                                    us = 0 + String(i);
                                } else {
                                    us = String(i);
                                }
                                us = beforeStr + us;

                                if ($('.relative').hasClass(us)) {
                                    jumpContent = us;
                                    break;
                                }
                            }
                        }
                        if ($('.relative').hasClass(jumpContent)) {
                            $('#makedImg').scrollTop(0);
                            sTop = $('.' + jumpContent).offset().top - 100;
                            $('#makedImg').scrollTop(sTop);
                        } else {
                            //alert('没有这个时间点');
                            VOD.Plugin.tips("error", '没有这个时间点');
                        }
                    } else {
                        var jc = $('#jumpContent').val();
                        if (!VOD.Util.isJumpData(jc, 0)) {
                            //alert('跳转输入格式错误');
                            VOD.Plugin.tips("error", '跳转输入格式错误');
                            return false;
                        }
                        jumpContent = jc + '-jump';
                        if ($('.relative').hasClass(jumpContent)) {
                            $('#makedImg').scrollTop(0)
                            sTop = $('.' + jumpContent).offset().top - 100;
                            $('#makedImg').scrollTop(sTop);
                        } else {
                            //alert('没有这帧');
                            VOD.Plugin.tips("error", '没有这帧');
                        }
                    }
                })
            },
            initSuggest: function () {
                var self = this;
                var channelTypeSuggest = {
                    options: {
                        source: VOD.urlConfig.redirect,
                        renderPanel: function (handler) {
                            self.dao.getChannelType(handler)
                        },
                        select: function (event, object) {
                            console.log("trihger  channelTypeSuggest");
                            $("input[name=albumName]").removeAttr("disabled");
                            $("input[name=albumName]").val("");
                            if (object.item.id == 25 && $('input[name=videotype]:checked').val() == -1) {
                                $("#locationDiv").css('display', 'block');
                            } else {
                                $("#locationDiv").css('display', 'none');
                            }
                            VOD.Util.setCooperativePartner(object.item.value);
                            return true;
                        },
                        autoFilter: false,
                        method: "post",
                        multiple: false,
                        parseValue: function () {
                            var val = this.element.val(),
                                ret = []
                            return ret;
                        },
                        getParam: function (term) {
                            var params = term.length == 0 ? {size: 100} : {word: term, size: 100}
                            var requestData = {url: VOD.Constant.thirdUrl_channel, type: "get", params: params, needCookie: true};
                            return {"request": JSON.stringify(requestData), timeSign: new Date().getTime()}
                        },

                        process: function (json) {
                            var ret = [],
                                self = this,
                                options = self.options,
                                itemData = null;
                            var data = null;
                            if (json == null) {
                                return [];
                            }
                            if (json.code === "A00000") {
                                data = $.isArray(json) ? json : json.data;
                            }
                            if (!data) {
                                return [];
                            }
                            $.map(data, function (item) {
                                itemData = {};
                                itemData[options.valueKey] = item["id"];
                                itemData[options.labelKey] = item["name"];
                                itemData["value"] = item["name"];
                                ret.push(itemData);
                            });
                            return ret;
                        },

                        template: function (item) {
                            return item["label"];
                        }
                    }
                }
                var albumSuggest = {
                    options: {
                        source: VOD.urlConfig.redirect,
                        method: "post",
                        multiple: false,
                        parseValue: function () {
                            return [];
                        },
                        getParam: function (term) {
                            var channelId = $("input[name=categoryName]").suggest("getValue")
                            var requestData = {url: VOD.Constant.thirdUrl_album, type: "get", params: {word: term, type: "displayName", filter_EQL_channel: channelId}, needCookie: true};
                            return {"request": JSON.stringify(requestData), timeSign: new Date().getTime()}
                        },
                        process: function (json) {
                            var ret = [],
                                self = this,
                                options = self.options,
                                itemData = null;
                            var data = null;
                            if (json == null) {
                                return [];
                            }
                            if (json.code === "A00000") {
                                data = $.isArray(json) ? json : json.data;
                            }
                            if (!data) {
                                return [];
                            }
                            $.map(data, function (item) {
                                itemData = {};
                                itemData[options.valueKey] = item["entityId"];
                                itemData[options.labelKey] = item["displayName"];
                                itemData["value"] = item["displayName"];
                                ret.push(itemData);
                            });
                            return ret;
                        },
                        template: function (item) {
                            return item["label"];
                        }
                    }
                }
                var locationSuggest = {
                    options: {
                        source: VOD.urlConfig.redirect,
                        method: "post",
                        multiple: false,
                        parseValue: function () {
                            return [];
                        },
                        getParam: function (term) {
                            var requestData = {url: VOD.Constant.thirdUrl_locationUrl, type: "get", params: {word: term, type: "province,city", domestic: 1}, needCookie: true};
                            return {"request": JSON.stringify(requestData), timeSign: new Date().getTime()}
                        },
                        process: function (json) {
                            var ret = [],
                                self = this,
                                options = self.options,
                                itemData = null;
                            var data = null;
                            if (json == null) {
                                return [];
                            }
                            if (json.code === "A00000") {
                                data = $.isArray(json) ? json : json.data;
                            }
                            if (!data) {
                                return [];
                            }
                            $.map(data, function (item) {
                                itemData = {};
                                itemData[options.valueKey] = item["id"];
                                itemData[options.labelKey] = item["name"];
                                itemData["value"] = item["name"];
                                ret.push(itemData);
                            });
                            return ret;
                        },
                        template: function (item) {
                            return item["label"];
                        }
                    }
                }

                var videoSuggest = {
                    options: {
                        source: VOD.urlConfig.redirect,
                        method: "post",
                        multiple: false,
                        parseValue: function () {
                            return [];
                        },
                        validate:false,
                        getParam: function (term) {
                            var videotype = $('input[name=videotype]:checked').val();
                            $("input[name=videoName]").suggest("option", "stopSuggest", videotype == -1);
                            var requestData = {url: VOD.Constant.thirdUrl_simple_video, type: "get", params: {word: term, type: "properTitle", isMade: videotype}, needCookie: true};
                            return {"request": JSON.stringify(requestData), timeSign: new Date().getTime()}
                        },
                        process: function (json) {
                            var ret = [],
                                self = this,
                                options = self.options,
                                itemData = null;
                            var data = null;
                            if (json == null) {
                                return [];
                            }
                            if (json.code === "A00000") {
                                data = $.isArray(json) ? json : json.data;
                            }
                            if (!data) {
                                return [];
                            }
                            $.map(data, function (item) {
                                itemData = {};
                                itemData[options.valueKey] = item["entityId"];
                                itemData[options.labelKey] = item["properTitle"];
                                itemData["value"] = item["properTitle"];

                                itemData["videoId"] = item["entityId"] || 0;
                                itemData["videoName"] = item["properTitle"] || "";

                                itemData["categoryName"] = item["categoryName"] || "";
                                itemData["categoryId"] = item["categoryId"] || 0;

                                itemData["albumName"] = item["albumDisplayName"] || "";
                                itemData["albumId"] = item["albumId"] || 0;
                                ret.push(itemData);
                            });
                            return ret;
                        },
                        select: function (event, object) {
                            if(  object.item.albumId > 0 ){
                                $("input[name=albumName]").suggest("setValue",{id:object.item.albumId,label:object.item.albumName})
                            }else{
                                $("input[name=albumName]").suggest("setValue","")
                            }
                            if(  object.item.videoId > 0 ){
                                $("input[name=videoName]").suggest("setValue",{id:object.item.videoId,label:object.item.videoName})
                            }else{
                                $("input[name=videoName]").suggest("setValue","")
                            }
                            if(  object.item.categoryId > 0 ){
                                $("input[name=categoryName]").suggest("setValue",{id:object.item.categoryId,label:object.item.categoryName});
                            }else{
                                $("input[name=categoryName]").suggest("setValue","")
                            }
                            $('input[name=albumName],input[name=imageId],input[name=categoryName]').attr('disabled', 'disabled');
                            return true;
                        },
                        template: function (item) {
                            return item["label"];
                        }
                    }
                }

                $("input[name=categoryName]").suggest(channelTypeSuggest.options);
                $("input[name=albumName]").suggest(albumSuggest.options);
                $("input[name=location]").suggest(locationSuggest.options);
                $("input[name=videoName]").suggest(videoSuggest.options);
                var paramsData = self.dao.getParamsData();
                if(parseInt( paramsData.locationCategory)> 0 ){
                    $("input[name=location]").suggest("setValue",{id:paramsData.locationCategory,label: decodeURI( paramsData.location)})
                }
            },
            initGrid: function () {
                var self = this;
                self.config.PageBeanFrame = VOD.Util.createPageBean();
                self.config.PageBeanAdvert = VOD.Util.createPageBean();
                self.initFrameGrid();
                self.initAdvertGrid();
            },
            initFrameGrid: function (options, callback) {
                var self = this;
                var gridConfig = self.getGridConfig(self.config.TABLE_FRAME_LIST);
                options = $.extend(true, {}, gridConfig, options);
                self.options.$FrameGrid.jqGrid(options);
            },
            initAdvertGrid: function (options, callback) {
                var self = this;
                var gridConfig = self.getGridConfig(self.config.TABLE_ADVERT_LIST);
                options = $.extend(true, {}, gridConfig, options);
                self.options.$AdvertGrid.jqGrid(options);
            }

        })
    }
);